import {CronJob} from 'cron';
import {STATIC_TMP_PATH} from '@/config';
import {deleteFile} from '@/utils/file';

export default CronJob.from({
    cronTime: '*/30 * * * *', // 每半小时清理一次
    onTick: function () {
        try {
            deleteFile(STATIC_TMP_PATH, {extensions: ['.png', '.jpeg', '.jpg'], recurs: true});
        } catch (error) {
            console.log(error);
        }
    },
    start: false,
    timeZone: 'America/Los_Angeles'
});
